package com.qzxy.premiumhotelsystem.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qzxy.premiumhotelsystem.domain.dto.OrderPageDTO;
import com.qzxy.premiumhotelsystem.domain.entity.Orders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qzxy.premiumhotelsystem.domain.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
* @author 14912
* @description 针对表【orders】的数据库操作Mapper
* @createDate 2024-09-12 15:55:14
* @Entity com.qzxy.premiumhotelsystem.domain.pojo.Orders
*/
@Mapper
public interface OrdersMapper extends BaseMapper<Orders> {

    IPage<OrderVO> pageQueryOrderVos(IPage<OrderVO> page, @Param("dto") OrderPageDTO orderPageDTO);

    OrderDetailVO selectOrderDetailVO(String orderId);

    List<Orders> findUnpaidOrders(Date fifteenMinutesAgo);

    List<OrderInEmailVO> findOrdersWithUpcomingCheckIn();

    List<OrderOutEmailVO> findOrdersWithUpcomingCheckOut();

    @Select("SELECT * FROM orders o WHERE o.check_out_time < CURRENT_TIMESTAMP AND o.status = '已入住'")
    List<Orders> findOverdueOrders();

}




